package cn.edu.leetcode.其他;

public class 回文数 {

    public static void main(String[] args) {
        System.out.println(isPalindrome(1221));
    }


    public static boolean isPalindrome(int x) {

        String string = "" + x;
        char[] s = string.toCharArray();
        int l = s.length;

        for (int i = 0; i < l / 2; i++) {
            if (s[i] != s[l-i-1]) {
                return false;
            }
        }
        return true;
    }
}
